import 'package:logger/logger.dart';

class FullConsoleOutput extends LogOutput {
  final int _maxLen = 128;

  void _printLog(Object? object) {
    String da = object?.toString() ?? 'null';
    if (da.length <= _maxLen) {
      print(da);
      return;
    }
    while (da.isNotEmpty) {
      if (da.length > _maxLen) {
        print(da.substring(0, _maxLen));
        da = da.substring(_maxLen, da.length);
      } else {
        print(da);
        da = '';
      }
    }
  }

  @override
  void output(OutputEvent event) {
    event.lines.forEach(_printLog);
  }
}
